package blazingbubble.lobby.command.net;

import blazingbubble.command.NetworkCommand;
import blazingbubble.lobby.command.CreateGameCommand;
import moltencore.game.Game;
import spark.network.Sender;
import spark.network.NetworkConnection;

public class NetCreateGameCommand extends CreateGameCommand {
	private NetworkCommand networkCommand;

	public NetCreateGameCommand(Sender sender, NetworkConnection serverConnection) {
		networkCommand = new NetworkCommand(sender, serverConnection);
	}

	@Override
	public void createGame(
							String gameName,
							Game.Mode mode,
							int maxPlayers,
							int normalBubblesCount,
							boolean ghostBubblesEnabled,
							boolean rainbowBubblesEnabled,
							boolean blazingBubblesEnabled,
							boolean gravityEnabled,
							boolean windEnabled,
							boolean flippedFieldEnabled,
							boolean teamsEnabled
							) {
		moltencore.network.protocol.CreateGame packet = new moltencore.network.protocol.CreateGame();
		packet.setGameMode(mode);
		packet.setGameName(gameName);
		packet.setPlayerLimit((byte) maxPlayers);
		packet.setOrdinaryBubbleCount((byte) normalBubblesCount);
		packet.setGhostBubbles(ghostBubblesEnabled);
		packet.setRainbowBubbles(rainbowBubblesEnabled);
		packet.setBlazingBubbles(blazingBubblesEnabled);
		packet.setGravity(gravityEnabled);
		packet.setWind(windEnabled);
		packet.setChainReactions(false);
		packet.setCriticalMass((byte) 3);
		packet.setTeams(teamsEnabled);
		networkCommand.send(packet);
	}
}
